#include "factory.h"

#include "base_classifier.h"
#include "random_classifier.h"
#include "stamp_classifier.h"
#include "libsvm_classifier.h"
#include "random_hyperplane_classifier.h"
#include "offset_classifier.h"

#include "boosting_algorithm.h"
#include "adaboost.h"
#include "real_adaboost.h"
#include "baseline_bagging.h"
#include "separated_adaboost.h"
#include "cascade_bagging.h"
#include "unbalanced_adaboost.h"

#include "resampler.h"
#include "weighted_resampler.h"
#include "separated_weighted_resampler.h"
#include "equal_resampler.h"

base_classifier * factory::get_classifier(string type) {
	base_classifier * result = NULL;
	if(type.compare(RANDOM_CLASSIFIER) == 0) {
		result = new random_classifer();
	} else if(type.compare(STAMP_CLASSIFIER) == 0) {
		result = new stamp_classifier();
	} else if(type.compare(LIBSVM_CLASSIFIER) == 0) {
		result = new libsvm_classifier();
	} else if(type.compare(RANDOM_HYPERPLANE_CLASSIFIER) == 0) {
		result = new random_hyperplane_classifier();
	} else if(type.compare(OFFSET_LIBSVM_CLASSIFIER) == 0) {
		result = new offset_libsvm_classifier();
	}

	return result;
}

boosting_algorithm * factory::get_algorithm(string type) {
	boosting_algorithm * result = NULL;
	if(type.compare("adaboost") == 0) {
		result = new adaboost();
	} else if(type.compare("real_adaboost") == 0) {
		result = new real_adaboost();
	} else if(type.compare("baseline_bagging") == 0) {
		result = new baseline_bagging();
	} else if(type.compare("separated_adaboost") == 0) {
		result = new separated_adaboost();
	} else if(type.compare("cascade_bagging") == 0) {
		result = new cascade_bagging();
	} else if(type.compare("unbalanced_adaboost") == 0) {
		result = new unbalanced_adaboost();
	} else if(type.compare("unbalanced_real_adaboost") == 0) {
		result = new unbalanced_real_adaboost();
	} else if(type.compare("baseline_gradual_bagging") == 0) {
		result = new baseline_gradual_bagging();
	} else if(type.compare("cascade_gradual_bagging") == 0) {
		result = new cascade_gradual_bagging();
	}

	return result;
}

resampler * factory::get_resampler(string type) {
	resampler * result = NULL;
	if(type.compare("weighted_resampler") == 0) {
		result = new weighted_resampler();
	} else if(type.compare("separated_weighted_resampler") == 0) {
		result = new separated_weighted_resampler();
	} else if(type.compare("equal_resampler") == 0) {
		result = new equal_resampler();
	} else if(type.compare("weighted_once_resampler") == 0) {
		result = new weighted_once_resampler();
	} else if(type.compare("separated_weighted_once_resampler") == 0) {
		result = new separated_weighted_once_resampler();
	}

	return result;
}
